package com.baiwei.vpnapi.config.security;

import com.baiwei.vpnapi.filter.JwtTokenFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

/**
 * @program: vpnapi
 * @description: 拦截器配置
 * @author: Mr. Stone
 * @create: 2020-03-11 19:40
 **/

@Configuration
public class StarsFilterConfiguration {
    @Bean
    public FilterRegistrationBean filterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.addUrlPatterns("/vpn/*");
        registration.addUrlPatterns("/admin/*");
        registration.addUrlPatterns("/pay/*");
        registration.addUrlPatterns("/auth/*");
        registration.addUrlPatterns("/app/*");
        registration.setFilter(StarFilter());
        return registration;
    }

    @Bean
    JwtTokenFilter StarFilter() {
        return new JwtTokenFilter();
    }

}
